﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Sagacity.NC.PersonManagement
{
    public partial class GetImage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string sn = Page.Request["Name"].ToString();
                Page.Response.Clear();
                if (Session[sn] != null && Session[sn].GetType() != Type.GetType("System.DBNull"))
                {
                    byte[] data = (byte[])Session[sn];
                    if (data.Length == 0)
                    {
                        Page.Response.Redirect("../resources/images/xy_temp.gif");
                    }
                    else
                    {
                        Page.Response.BinaryWrite(data);
                        Page.Response.Flush();
                        Page.Response.End();
                    }
                }
                else
                {
                    Page.Response.Redirect("../resources/images/xy_temp.gif");
                }
            }
            catch
            {
                Page.Response.Redirect("../resources/images/xy_temp.gif");
            }
        }
    }
}
